package ltd.hanamaki.study.oop.demo02;

/**
 * 这是一个 游人类
 */
public class Tourist {

    String name;

    Integer age;

    /* alt + insert */

    public Tourist() {
    }

    public Tourist(String name, Integer age) {
        this.name = name;
        this.age = age;
        if (this.age >= 18 && age <= 60) {
            System.out.println(name + "的年龄为：" + age + ",门票价格为：20元");
        } else {
            System.out.println(name + "的年龄为：" + age + ",门票免费");
        }
    }

    @Override
    public String toString() {
        if (this.age >= 18 && age <= 60) {
            return name + "的年龄为：" + age + ",门票价格为：20元";
        } else {
            return name + "的年龄为：" + age + ",门票免费";
        }

    }
}
